<div class="layui-layout layui-layout-admin" id="layui-admin"  onload="close()" >
    <div class="layui-header">
        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item layadmin-flexible" lay-unselect>
                <a href="javascript:;" layadmin-event="flexible">
                    <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                </a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;" layadmin-event="refresh">
                    <i class="layui-icon layui-icon-refresh-3"></i>
                </a>
            </li>
        </ul>
        <script type="text/html" template lay-url="/Account/GetUser?proId={{proname}}" lay-type="post"
                lay-done="layui.element.render('nav', 'layadmin-layout-right');">
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">

                {{# if(d.data){}}
                <!--<li class="layui-nav-item" lay-unselect>
                    <a lay-href="/admin/system/noticeList" layadmin-event="message">
                        <i class="layui-icon layui-icon-notice"></i>
                        <span class="{{d.data.noticeCount == true ? 'layui-badge-dot' : ''}}"></span>
                    </a>
                </li>-->
                
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        
                    </a>
                </li> 
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite>{{ d.data['UserName'+layui.admin.lang] }}</cite>
                    </a>
                    <dl class="layui-nav-child" style="text-align:center">
                        <dd><a lay-href="admin/userSetPassword">{{layui.admin.lang?'change password':'修改密码'}}</a></dd>
                        <dd><a href="javascript:;" layadmin-event="logout">{{layui.admin.lang?'logout':'登出'}}</a></dd>
                    </dl>
                </li>
                <!--<li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite>{{layui.admin.lang?'English':'简体中文'}}</cite>

                    </a>
                    <dl class="layui-nav-child" style="text-align:center">
                        <dd> <a  href="javascript:;" layadmin-event="ChangeCn">简体中文</a></dd>
                        <dd> <a  href="javascript:;" layadmin-event="ChangeEn">English</a></dd>

                    </dl>
                </li>-->
                {{# } }}

                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite>{{layui.admin.lang==='_EN'?'English':'Chinese'}}</cite>
                    </a>

                    <dl class="layui-nav-child" style="text-align:center">
                        <dd><a layadmin-event="setLanguage" data-lang="">Chinese</a></dd>
                        <dd><a layadmin-event="setLanguage" data-lang="_EN">English</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="theme">
                        <i class="layui-icon layui-icon-theme"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>
            </ul>
        </script>
    </div>

    <!-- 侧边菜单 -->
    <div class="layui-side layui-side-menu">
        <div class="layui-side-scroll">
            <script type="text/html" template>

                <div class="layui-logo" lay-href="">

                    <font size="2">  system </font>
                </div>
            </script>
            <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu"></ul>
        </div>
    </div>


    <!-- 页面标签 -->
    <script type="text/html" template lay-done="layui.element.render('nav', 'layadmin-pagetabs-nav')">
        {{# if(layui.setter.pageTabs){ }}
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前页签</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它页签</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭所有页签</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="/"><i class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>
        {{# } }}
    </script>


    <!-- 主体内容 -->
    <div class="layui-body" id="LAY_app_body">
        <div class="layadmin-tabsbody-item layui-show"></div>
    </div>

    <!-- 辅助元素，一般用于移动设备下遮罩 -->
    <div class="layadmin-body-shade" layadmin-event="shade"></div>
</div>
<script src="/Scripts/src/lib/static/jquery-3.2.1.js"></script>
<script>
    var proname = getRequest();
    function getRequest() {
        debugger;
        var url = location.search; //获取url中"?"符后的字串
        var theRequest = "";
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                if (strs[i].split("=")[0] == "proId") {
                    theRequest = unescape(strs[i].split("=")[1]);
                }
            }
        }
        return theRequest.replace("\'", "").replace("\'", "");
    }
    layui.use('element', function () {
        var $ = layui.$
            , element = layui.element
            , admin = layui.admin
            , setter = layui.setter;

        var path = layui.router().path
            , pathURL = layui.admin.correctRouter(path.join('/'));
        pathURL = $.inArray(pathURL, layui.setter.templatePage) > -1 ? (pathURL + '/pageId=' + layui.router().search.pageId) : pathURL;
        //gethomepage()
        //function gethomepage() {
        //                    admin.req({
        //            url: '/Account/GetFirstIndex'
        //            , type: 'post'
        //            , data: { proId: proname }
        //            , done: function (res) {
        //                console.log("123", res.data != "");
        //                if (res.data != "") {
        //                    setter.entry = res.data;
        //                    console.log(setter.entry);
        //                }
        //            }
        //        });
        //}
        //savepro();
        //function savepro() {
        //    admin.req({
        //        url: '/Admin/SaveProject'
        //        , type: 'post'
        //        , loading: false
        //        , tipOk: false,
        //        data: { proId: proname }
        //    })
        //} 

        function binDataManageMenu() {


            admin.req({
                url: '/Account/GetMenu'
                , type: 'post'
                , loading: false
                , tipOk: false,
                data: { proId: proname }
                , done: function (res) {
                    admin.sessionData({ page: res.data });
                    //console.log("21321",res.project)
                    //var tempArray = [];
                    var menuHtml = '';
                    debugger;
                    //var sys = admin.filterList(res.data, { PageType: 'os',PageName_EN:'admin'});
                    $.each(admin.filterList(res.data, { ParentID: '66601a83-e7b9-4bdf-83f0-4ff4f8d1fd92' }), function (idx, item) {
                        //if ($.inArray(item.PageID, tempArray) === -1 && item.ParentID === sys[0].PageID) {

                        var url = $.inArray(item.TemplateUrl, layui.setter.templatePage) > -1 ? (item.TemplateUrl + '/pageId=' + item.PageID) : item.PageUrl;

                        var children = admin.filterList(res.data, { ParentID: item.PageID, PageType: 'page', IsHide: false })
                            , isThis = children.length === 0 && pathURL === url && url !== '';
                        menuHtml += '<li class="layui-nav-item' + (isThis ? ' layui-this' : '') + '" data-jump="' + url + '"><a href="javascript:;"' + (isThis ? ' lay-href="' + url + '"' : '') + ' lay-tips="' + item['PageName' + admin.lang] + '"><i class="layui-icon ' + item.PageIcon + '"></i> <cite>' + item['PageName' + admin.lang] + '</cite></a>';
                        if (children.length > 0) {
                            menuHtml += '<dl class="layui-nav-child">';
                            menuHtml += getMenuHtml(res.data, item.PageID);
                            menuHtml += '</dl>';
                        }
                        menuHtml += '</li>';
                        //tempArray.push(item.PageID);
                        //}
                    });
                    $('#LAY-system-side-menu').html(menuHtml);

                    admin.sideThis();

                    element.render('nav', 'layadmin-system-side-menu');
                }
            });
          /*  admin.initSessionData();*/

        }
        binDataManageMenu('');
        function getMenuHtml(data, parentId) {
            var menuHtml = "";

            $.each(admin.filterList(data, { ParentID: parentId, PageType: 'page', IsHide: false }), function (idx, item) {
                var url = $.inArray(item.TemplateUrl, layui.setter.templatePage) > -1 ? (item.TemplateUrl + '/pageId=' + item.PageID) : item.PageUrl;

                var children = admin.filterList(data, { ParentID: item.PageID, PageType: 'page', IsHide: false })
                    , isThis = children.length === 0 && pathURL === url && url !== '';

                if (children.length > 0) {
                    menuHtml += '<dd data-jump="' + item.url + '"><a href="javascript:;" ><i class="layui-icon ' + item.PageIcon + '"></i> <cite>' + item['PageName' + admin.lang] + '</cite></a><dl class="layui-nav-child">';
                    menuHtml += getMenuHtml(data, item.PageID);
                    menuHtml += '</dl></dd>';
                } else
                    menuHtml += '<dd' + (isThis ? ' class="layui-this"' : '') + ' data-jump="' + url + '"><a href="javascript:;" lay-href="' + url + '"><i class="layui-icon ' + item.PageIcon + '"></i>' + item['PageName' + admin.lang] + '</a></dd>'
            })

            return menuHtml;
        }

        layui.use('excel');
    })
</script>
 